using Items;

public abstract class ItemUI_Button : MyButton
{
    protected ItemUI_Manager manager;

    protected override void Awake()
    {
        base.Awake();
        manager = CommonUI.GetUIComponent<ItemUI_Manager>();
        manager.RightClickItem += OnRightClickItem;
    }

    protected override void OnClick()
    {
        manager.OptionPanel.Hide();
    }

    protected virtual void OnRightClickItem() { }

    public bool CheckAvtive()
    {
        Equipment equipment = manager.TargetStack.ItemAttached as Equipment;
        return IsActive(manager.InputState,
            manager.TargetStack.ItemAttached,
            equipment,
            equipment != null && manager.EquipmentManager.Equipments.ContainsValue(equipment)
            );
    }

    public abstract bool IsActive(EGameState state, Item item, Equipment equipment, bool isEquipped);
}
